home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 22
/
Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso
/
Aminet
/
util
/
rexx
/
PGPwithYAM.lha
/
PGPwithYAM
/
source
/
SplitMail.e
Wrap
Text File
|
1997-06-18
|
2KB
|
130 lines
/******************************************\
* *
\******************************************/
-> PROC Module
MODULE 'dos/dos'
MODULE 'utility/tagitem'
MODULE 'intuition/intuition'
-> ENDPROC
-> PROC #defines
-> ENDPROC
-> PROC Raises
RAISE "ARGS" IF ReadArgs()=NIL,
"FILE" IF Open()=NIL
-> ENDPROC
-> PROC Objekte
OBJECT rdargs
readargs,
args[1]: ARRAY OF LONG
ENDOBJECT
OBJECT files
fin,fhead,fbody,
buffer
ENDOBJECT
-> ENDPROC
-> PROC Konstante
CONST KICKVERSION=39
-> ENDPROC
-> PROC Variable
-> ENDPROC
-> PROC Instanzen
DEF rdargs: PTR TO rdargs,
files: PTR TO files
-> ENDPROC
/*
** Methoden
*/
PROC get(str) OF rdargs
self.readargs:=ReadArgs(str,self.args,NIL)
ENDPROC
PROC end() OF rdargs
IF self.readargs THEN FreeArgs(self.readargs)
ENDPROC
CHAR '$VER: SplitMail 1.0 (18.6.97) by Michael Praschl'
PROC bodycopy() OF files
DEF ok
REPEAT
ok:=self.read()
IF ok>=0 THEN self.write(self.fbody)
UNTIL (ok=-1)
ENDPROC
PROC headcopy() OF files
DEF ok
REPEAT
ok:=self.read()
IF ok>=0 THEN self.write(self.fhead)
UNTIL (ok=-1) OR (ok=1)
ENDPROC ok
PROC write(out) OF files
Fputs(out,self.buffer)
ENDPROC
PROC read() OF files
DEF ok
ok:=Fgets(self.fin,self.buffer,200)
ENDPROC IF ok THEN StrLen(self.buffer) ELSE -1 /* Eof() = -1 */
PROC open(finname) OF files
self.buffer:=String(200)
IF self.buffer=NIL THEN Raise("MEM")
self.fin:=Open(finname,OLDFILE)
self.fhead:=Open('ram:head',NEWFILE)
self.fbody:=Open('ram:body',NEWFILE)
ENDPROC
PROC end() OF files
IF self.fin THEN Close(self.fin)
IF self.fhead THEN Close(self.fhead)
IF self.fbody THEN Close(self.fbody)
IF self.buffer THEN DisposeLink(self.buffer)
ENDPROC
/*
** Prozeduren
*/
PROC open_all()
NEW rdargs
rdargs.get('FILENAME/A')
NEW files
files.open(rdargs.args[0])
files.headcopy()
files.bodycopy()
ENDPROC
PROC close_all()
END files
END rdargs
ENDPROC
/*****************\
* Hauptprogramm *
\*****************/
PROC main() HANDLE
IF KickVersion(KICKVERSION)=FALSE THEN Raise("KICK")
open_all()
EXCEPT DO
close_all()
IF exception
SELECT exception
CASE "KICK"
WriteF('Kickstart V\d++ required!\n',KICKVERSION)
CASE "NIL"
WriteF('NILpointer in line \d\n',exceptioninfo)
DEFAULT
WriteF('Exception ')
Write(stdout,{exception},4)
WriteF(' raised!\n')
ENDSELECT
ENDIF
ENDPROC